;Automatic placement of bore & jack casing pipe in profile.
;
;
;	AUTHOR: HENRY C. FRANCIS
;		425 N. ASHE ST.
;		SOUTHERN PINES, NC 28387
;		All rights reserved without prejudice.
;
;	Copyright:	1-30-96
;	Edited:		1-30-96
;
(defun c:bandj (/ solss ss count sslen dimsc curel dipx2 whend howm)
  (setq solss (ssget '((0 . "SOLID")))
        ss (ssadd)
        curel (getvar"elevation")
        colr "2"
        llt "-"
        prod "SSWR"
        modf "NEWW"
  );setq
  (if dimscl nil (load"dimscl"))
  (dimscl)
  (setvar"elevation"(* 1002 dimsc))
  (setvar"hpang"0)
  (setvar"hpname""ansi31")
  (setvar"hpscale"(/ dimsc 2))
  (c:svlayr)
  (c:mklayr)
  (setq sent (entget(ssname solss 0))
        plp1 (cdr(assoc 10 sent))
        plp1 (list(car plp1)(cadr plp1)(* dimsc 1002))
        plp2 (cdr(assoc 11 sent))
        plp2 (list(car plp2)(cadr plp2)(* dimsc 1002))
        plp3 (cdr(assoc 12 sent))
        plp3 (list(car plp3)(cadr plp3)(* dimsc 1002))
        plp4 (cdr(assoc 13 sent))
        plp4 (list(car plp4)(cadr plp4)(* dimsc 1002))
  );setq
  (setq casz (uint 1 "" "Casing Pipe Size (inches)" (if casz casz nil))
        hcasz (*(/ casz 24.00)10)
        dipx1 (upoint 1 "" "Beginning Station" nil nil)
        dipx1 (list(car dipx1)(cadr dipx1)(* dimsc 1002))
        dipx2 (upoint 1 "" "Ending Station" nil dipx1)
        dipx2 (list(car dipx2)(cadr dipx2)(* dimsc 1002))
  );setq
  (setq plp1 (inters plp1 plp2 dipx1 (polar dipx1 (/ pi 2) 1) nil)
        plp2 (inters plp1 plp2 dipx2 (polar dipx2 (/ pi 2) 1) nil)
        plp3 (inters plp4 plp3 dipx1 (polar dipx1 (/ pi 2) 1) nil)
        plp4 (inters plp3 plp4 dipx2 (polar dipx2 (/ pi 2) 1) nil)
        osdis (- hcasz(/(distance plp1 plp3)2))
        tplp1 (polar plp1 (/ pi 2) osdis)
        tplp2 (polar plp2 (/ pi 2) osdis)
        bplp1 (polar plp4 (* pi 1.5) osdis)
        bplp2 (polar plp3 (* pi 1.5) osdis)
  );setq
  (command ".pline" plp1 tplp1 tplp2 plp2 "")
  (command ".pline" plp4 bplp1 bplp2 plp3 "")
  (c:rslayr)
  (setvar"elevation"curel)
  (princ)
);defun
